//package com.github.zdongcoding.recyclerviewlib;
//
//import android.app.Activity;
//import android.content.Intent;
//import android.os.Bundle;
//import android.support.annotation.Nullable;
//import android.support.v4.app.Fragment;
//import android.support.v7.widget.LinearLayoutManager;
//import android.support.v7.widget.RecyclerView;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.CompoundButton;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import com.dinuscxj.itemdecoration.PinnedHeaderDecoration;
//import com.dinuscxj.recycleritemdecoration.foundation.RecyclerListAdapter;
//import com.dinuscxj.recycleritemdecoration.foundation.RecyclerListFragment;
//import com.dinuscxj.recycleritemdecoration.foundation.SingleFragmentActivity;
//import com.dinuscxj.recycleritemdecoration.model.ItemAnimal;
//import com.dinuscxj.recycleritemdecoration.model.ItemCartoon;
//import com.dinuscxj.recycleritemdecoration.model.ItemDrawable;
//import com.dinuscxj.recycleritemdecoration.model.ItemScenic;
//import com.dinuscxj.recycleritemdecoration.model.ItemTitle;
//import com.dinuscxj.recycleritemdecoration.viewholder.AnimalViewHolder;
//import com.dinuscxj.recycleritemdecoration.viewholder.CartoonViewHolder;
//import com.dinuscxj.recycleritemdecoration.viewholder.ScenicViewHolder;
//import com.dinuscxj.recycleritemdecoration.viewholder.TitleViewHolder;
//
//public class PinnedHeaderActivity extends SingleFragmentActivity {
//
//    public static void startActivity(Activity activity) {
//        Intent intent = new Intent(activity, PinnedHeaderActivity.class);
//        activity.startActivity(intent);
//    }
//
//    @Override
//    protected Fragment createFragment() {
//        return PinnedHeaderFragment.newInstance();
//    }
//
//    public static class PinnedHeaderFragment extends RecyclerListFragment {
//
//        public static PinnedHeaderFragment newInstance() {
//            return new PinnedHeaderFragment();
//        }
//
//        @Override
//        public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
//            super.onViewCreated(view, savedInstanceState);
//            getAdapter().addAll(createItemDrawableList());
//        }
//
//        private List<ItemDrawable> createItemDrawableList() {
//            List<ItemDrawable> itemDrawableList = new ArrayList<>();
//            // ItemAnimal
//            itemDrawableList.add(new ItemTitle(R.drawable.ic_title_animal, getString(R.string.title_animal)));
//            itemDrawableList.add(new ItemAnimal(R.drawable.ic_animal0, getString(R.string.animal0)));
//            itemDrawableList.add(new ItemAnimal(R.drawable.ic_animal1, getString(R.string.animal1)));
//            itemDrawableList.add(new ItemAnimal(R.drawable.ic_animal2, getString(R.string.animal2)));
//            // ItemCartoon
//            itemDrawableList.add(new ItemTitle(R.drawable.ic_title_cartoon, getString(R.string.title_cartoon)));
//            itemDrawableList.add(new ItemCartoon(R.drawable.ic_cartoon0, getString(R.string.cartoon0)));
//            itemDrawableList.add(new ItemCartoon(R.drawable.ic_cartoon1, getString(R.string.cartoon1)));
//            itemDrawableList.add(new ItemCartoon(R.drawable.ic_cartoon2, getString(R.string.cartoon2)));
//            // ItemScenic
//            itemDrawableList.add(new ItemTitle(R.drawable.ic_title_scenic, getString(R.string.title_scenic)));
//            itemDrawableList.add(new ItemScenic(R.drawable.ic_scenic0, getString(R.string.scenic0)));
//            itemDrawableList.add(new ItemScenic(R.drawable.ic_scenic1, getString(R.string.scenic1)));
//            itemDrawableList.add(new ItemScenic(R.drawable.ic_scenic2, getString(R.string.scenic2)));
//
//            return itemDrawableList;
//        }
//
//        @Override
//        public RecyclerListAdapter onCreateAdapter() {
//            return new RecyclerListAdapter() {
//                {
//                    addViewType(ItemTitle.class, new ViewHolderFactory<ViewHolder>() {
//                        @Override
//                        public ViewHolder onCreateViewHolder(ViewGroup parent) {
//                            return new TitleViewHolder(parent);
//                        }
//                    });
//
//                    addViewType(ItemAnimal.class, new ViewHolderFactory<ViewHolder>() {
//                        @Override
//                        public ViewHolder onCreateViewHolder(ViewGroup parent) {
//                            return new AnimalViewHolder(parent);
//                        }
//                    });
//
//                    addViewType(ItemCartoon.class, new ViewHolderFactory<ViewHolder>() {
//                        @Override
//                        public ViewHolder onCreateViewHolder(ViewGroup parent) {
//                            return new CartoonViewHolder(parent);
//                        }
//                    });
//
//                    addViewType(ItemScenic.class, new ViewHolderFactory<RecyclerListAdapter.ViewHolder>() {
//                        @Override
//                        public ViewHolder onCreateViewHolder(ViewGroup parent) {
//                            return new ScenicViewHolder(parent);
//                        }
//                    });
//                }
//            };
//        }
//
//        @Override
//        public RecyclerView.LayoutManager onCreateLayoutManager() {
//            return new LinearLayoutManager(getActivity());
//        }
//
//        @Override
//        public RecyclerView.ItemDecoration onCreateItemDecoration() {
//            PinnedHeaderDecoration pinnedHeaderDecoration = new PinnedHeaderDecoration();
//            pinnedHeaderDecoration.registerTypePinnedHeader(getItemViewType(ItemTitle.class),
//                new PinnedHeaderDecoration.PinnedHeaderCreator() {
//                    @Override
//                    public boolean create(RecyclerView parent, int adapterPosition) {
//                        return true;
//                    }
//                }
//            );
//
//            return pinnedHeaderDecoration;
//        }
//
//        @Override
//        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//
//        }
//    }
//}
